/******************************************************************************
 **
 **    LISA Confidential
 **
 **    Source Materials
 **
 **    (C) COPYRIGHT LISA 2008-2009
 **
 **  File Name:      CommonDAO.java
 **  Description:
 **  Date:           2009-2-3
 **  Author:         LisaQian
 ******************************************************************************/
package com.ti.andon.persistent.dao;

import java.math.BigDecimal;
import java.util.List;

import org.hibernate.Query;

import com.ti.andon.workflow.dao.base.BaseHibernateDAO;

public class CommonDAO extends BaseHibernateDAO
{
	
	public long getNextSeqId(String seqname)
	{
		long nextId = 0;
		Query query = getSession().createSQLQuery("select " + seqname + ".nextval SEQID from dual");
		List list = query.list();
		if (null != list && list.size() > 0)
		{
			nextId = ((BigDecimal) list.iterator().next()).longValue();
		}
		return nextId;
	}

}
